#include<bits/stdc++.h>

using namespace std;
int a[31][31];
int n;
int x, y, nx, ny;

int main() {
    while (cin >> n) {
        if (n == 0)break;

        x = n - 1;
        y = n / 2;
        memset(a, 0, sizeof(a));
        for (int i = 1; i <= n * n; i++) {
            a[x][y] = i;
            //如果我的右下角为0（相对）就设置下一个为是右下角
            //否则就是我们的正上方
            nx = (x + 1) % n;
            ny = (y + 1) % n;
            if (a[nx][ny] != 0) {
                nx = (x - 1 + n) % n;
                ny = y;
            }
            x = nx;
            y = ny;
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}